from numpy import *
from pandas import DataFrame, Series
import pandas as pd
import numpy as np
import pylab as pl
import json

path = 'D:\\mine\\pydata-book-master\\ch02\\usagov_bitly_data2012-03-16-1331923249.txt'

records = [json.loads(line) for line in open(path)]
# records = open(path)
frame = DataFrame(records)
results = Series([x.split()[0] for x in frame['a'].dropna()])
print((results.value_counts())[:8])
